<?php 
$objectname=getObjByKey("portal_objects","name","id",$currentObject->objectname);
echo getObjByKey($objectname,"name","id",$currentObject->objectid);

?>